//
//  TableViewCellAnimationTableViewCell.m
//  MyFramework
//
//  Created by 余洋 on 2018/8/13.
//  Copyright © 2018年 余洋. All rights reserved.
//

#import "TableViewCellAnimationTableViewCell.h"
#import "POP.h"

@interface TableViewCellAnimationTableViewCell()

@property (weak, nonatomic) IBOutlet UILabel *titleLabel;

@end

@implementation TableViewCellAnimationTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated {
    [super setHighlighted:highlighted animated:animated];
    if (self.highlighted) {
        //基本动画
        POPBasicAnimation *scaleAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewScaleXY];
        //动画间隔
        scaleAnimation.duration = 0.1;
        scaleAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(1.3, 1.3)];
        [self.titleLabel pop_addAnimation:scaleAnimation forKey:@"scalingUp"];
    } else {
        //弹簧动画
        //springBounciness:4.0    [0-20] 弹力 越大则震动幅度越大
        //springSpeed     :12.0   [0-20] 速度 越大则动画结束越快
        //dynamicsTension :0      拉力  接下来这三个都跟物理力学模拟相关 数值调整起来也很费时 没事不建议使用哈
        //dynamicsFriction:0      摩擦 同上
        //dynamicsMass    :0      质量 同上
        POPSpringAnimation *sprintAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewScaleXY];
        sprintAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(1, 1)];
        sprintAnimation.springBounciness = 20.f;
        [self.titleLabel pop_addAnimation:sprintAnimation forKey:@"sprintAnimation"];
        //POPDecayAnimation 过阻尼效果
        //deceleration:0.998  衰减系数(越小则衰减得越快)
    }
}
@end
